#include "threadpool.hpp"
#include <thread>
#include <chrono>
#include <iostream>
#include <string>
#include "result.hpp"
using namespace std;
class mytask :public Task {
public:
	Any run() override
	{
		cout << "run!" << endl;
		string res = "runrun";
		return res;
	}
private:

};
int main() {
	threadPool pool;
	pool.setMode(poolMode::POOL_FIXED);//set the working mode
	pool.start(4);
	Result res1 = pool.submitTask(make_shared<mytask>());
	Result res2 = pool.submitTask(make_shared<mytask>());
	Result res3 = pool.submitTask(make_shared<mytask>());
	Result res4 = pool.submitTask(make_shared<mytask>());

	string ret1 = res1.get().cast_<string>();
	string ret2 = res2.get().cast_<string>();
	cout << ret1 << ret2 << endl;
	
	getchar();
	return 0;
}